<?php


class SelectShop extends Connection{
	private $conn;

	public function __construct(){
		Connection::init();
		$this->conn = $this->getConnection();
	}




	public function extractShopForNewOrders($id){
		$stmt = $this->conn->prepare("	SELECT s.id, s.`company_id`, d.direction as delivery , s.`name`, s.`address`, s.`phone`
											FROM  shop s
											join delivery d on (d.id = s.delivery_id)
											WHERE s.id =  ?");
		$stmt->bindValue(1,$id,PDO::PARAM_INT);
		$stmt->execute();
		$arr=$stmt->fetchall(PDO::FETCH_ASSOC);
		$arr[0]["shop_promo"]=array();
		$shop = new Shop($arr[0]);
		return $shop;
	}

	public function extractShop($id){
		$stmt = $this->conn->prepare("	select *
												from shop
												where company_id =  ? ");
		$stmt->bindValue(1, (int)$id, PDO::PARAM_INT);
		$stmt->execute();

		return $stmt->fetchAll(PDO::FETCH_ASSOC);
	}

}
?>